#pragma once
#include<iostream>
#include<memory>

using std::ostream;
using std::istream;
using std::bad_alloc;
using std::shared_ptr;

class String
{
private:
	shared_ptr<char> str;
	int len, capacity;
public:
	String(const char* s = nullptr);
	String(char*&&) noexcept;
	~String();
	String(const String&) noexcept;
	String(String&&) noexcept;
	String& operator=(const String&) noexcept;
	String& operator=(String&&) noexcept;
	int length()const noexcept;
	String operator+(const String& b)const;
	bool operator==(const String& b)const noexcept;
	friend ostream& operator<<(ostream& ot, const String& s);
	friend istream& operator>>(istream& it, String& s);
};

ostream& operator<<(ostream& ot, const String& s);
istream& operator>>(istream& it, String& s);
